﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="WebTest._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<ajaxToolkit:ToolkitScriptManager ID="scriptmanager1" runat="server"></ajaxToolkit:ToolkitScriptManager>
    <h2>
        Welcome to ASP.NET!
    </h2>
    <p>
        To learn more about ASP.NET visit <a href="http://www.asp.net" title="ASP.NET Website">www.asp.net</a>.
    </p>
    <p>
        You can also find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&amp;clcid=0x409"
            title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>.
    </p>
    <asp:TextBox ID="txtID" runat="server"></asp:TextBox><br />
    <asp:TextBox ID="txtName" runat="server"></asp:TextBox><br />
    <asp:TextBox ID="txtDesc" runat="server"></asp:TextBox><br />
    <asp:Button  ID="btnAdd" runat="server" Text="Add"/> 
    <asp:Button  ID="btnUpdate" runat="server" Text="Update"/>
    <asp:Button  ID="btnDelete" runat="server" Text="Delete"/>
    <asp:Button  ID="btnLoad" runat="server" Text="Load"/><%----%>
    <Kevin:DataBind ID="dataBind1" runat="server" ValidButtons="btnAdd" >
    <BindItems>
        <Kevin:DataBindItem ControlID="txtID" DataPropertyName="ActionID" />
        <Kevin:DataBindItem ControlID="txtName" DataPropertyName="ActionName" />
        <Kevin:DataBindItem ControlID="txtDesc" DataPropertyName="ActionDesc" />
    </BindItems>
    </Kevin:DataBind>
    <script>
        function init() {
            var control = document.getElementById("<%=txtID.ClientID %>");
            control.focus();
            control.attachEvent("onblur", cutInput);
            control.attachEvent("onkeypress", function (ev) {
                var k = ev.keyCode ? ev.keyCode : ev.rawEvent.keyCode;
                if(k=== 13) {
                    document.getElementById("<%=txtName.ClientID %>").focus();
                }
            });
            document.attachEvent("click", function () {
            control.focus();
            });
        }
        function cutInput() {
            var control = document.getElementById("<%=txtID.ClientID %>");
            control.value = control.value.substring(control.value.length - 16);

        }
        init();
    </script>
</asp:Content>
